package com.example.streamconsumer.highlevel;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Component;

/**
 * @Author: lihui
 * @Date: 2022-03-23 10:28
 * @Description:
 */
@Component
@EnableBinding(MyProcessor.class)
public class SmsAndEmailMessageProducer {

    @Autowired
    private MyProcessor myProcessor;

    public void sendSms(String message){
        myProcessor.smsOutput().send(MessageBuilder.withPayload(message).build());
    }

    public void sendEmail(String message){
        myProcessor.emailOutput().send(MessageBuilder.withPayload(message).build());
    }

}
